import 'package:json_annotation/json_annotation.dart';

part 'repair_model.g.dart';

@JsonSerializable()
class RepairPageModel {
  int? total;
  List<RepairModel>? list;
  RepairPageModel();

  factory RepairPageModel.fromJson(Map<String, dynamic> json) =>
      _$RepairPageModelFromJson(json);
  Map<String, dynamic> toJson() => _$RepairPageModelToJson(this);
}

@JsonSerializable()
class RepairModel {
  int? id;
  int? reportman;
  int? ebike_id;
  int? fault_id;
  String? fault_name;
  int? fault_type_id;
  String? fault_type_name;
  int? ebike_type_id;
  String? ebike_type_name;
  String? ebike_type_image;
  String? other;
  int? type;
  Map? coordinate;
  List<String>? photo;
  String? order_no;
  int? status;
  int? repairman;
  int? price;
  int? store_id;
  String? store_name;
  String? desc;
  int? repair_at;
  int? created_at;
  int? updated_at;

  RepairModel();

  factory RepairModel.fromJson(Map<String, dynamic> json) =>
      _$RepairModelFromJson(json);
  Map<String, dynamic> toJson() => _$RepairModelToJson(this);

  String getStatusStr() {
    switch (status) {
      case 0:
        return '待接单';
      case 1:
        return '进行中';
      case 2:
        return '已完成';
      case 3:
        return '已撤销';
      default:
        return '';
    }
  }
}
